package com.woniu.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.entity.FlowerComment;
import com.woniu.service.FlowerCommentService;
import com.woniu.util.JsonResult;
import com.woniu.vo.FlowerCommentVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@RestController
@Slf4j
@RequestMapping("/flowercomment")
public class FlowerCommentController {
    @Resource
    private FlowerCommentService flowerCommentService;
    
    // 修改投诉评价状态
    @RequestMapping("/updatecomplaintFlowerCommentByCommentId")
    public JsonResult<Integer> updatecomplaintFlowerCommentByCommentId(int contentId,String remark,Byte isDelete){
        FlowerComment flowerComment  = new FlowerComment(contentId,remark,isDelete);
        int i = flowerCommentService.updatecomplaintFlowerCommentByCommentId(flowerComment);
        return JsonResult.build(200,"修改成功",i);
    }
    //查看评价详情
    @RequestMapping("/selectFlowerCommentByCommentId")
    public JsonResult<FlowerCommentVo> selectFlowerCommentByCommentId(int contentId){
        FlowerComment flowerComment = new FlowerComment(contentId);
        FlowerCommentVo list = flowerCommentService.selectFlowerCommentByCommentId(flowerComment);
        return JsonResult.build(200,"查询成功",list);
    }
    //查看所有评价
    @RequestMapping("/selectAllFlowerComments")
    public JsonResult<PageInfo<FlowerCommentVo>> selectAllFlowerComments(Integer pageNum, Integer pageSize, String flowerName, String accountName, Long startTime, Long endTime, Integer rateScore, Integer isDelete){
        PageInfo<FlowerCommentVo> list = flowerCommentService.selectAllFlowerComments(pageNum, pageSize, flowerName, accountName, startTime, endTime,rateScore, isDelete);
        return JsonResult.ok(200, list);
    }
    
    
}
